package gao.xiaolei.dao;

import gao.xiaolei.entity.TestBug;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
import org.springframework.web.bind.annotation.PathVariable;

import java.util.List;

@Repository("TestBugDao")
public interface TestBugDao extends JpaRepository<TestBug, String> {

    public List<TestBug> findAllByProjectId(String projectId);

    public List<TestBug> findAllByAuthorAndProjectId(String author, String projectId);

    @Modifying
    @Query("update TestBug set grade=:grade where id=:id")
    public void updateGrade(@Param("id") String id,
                            @Param("grade") int grade);

    public Integer countAllByToTrq(String toTrq);
}
